/*
 * @Descripttion:
 * @version:
 * @Author: lfzxs@qq.com
 * @Date: 2023-08-28 16:51:14
 * @LastEditors: lfzxs@qq.com
 * @LastEditTime: 2023-08-28 17:20:47
 */
package utils

import (
	"strconv"

	"github.com/bwmarrin/snowflake"
)

const (
	// 结点idkey
	Nodeid_key = "nodeid"
	// 默认结点ID
	Default_nodeId = int64(1)
)


func CreateSnowflakeID()(int64,error){
	node, err := snowflake.NewNode(1)
	if err != nil {
		return -1,err
	}

	// Generate a snowflake ID.
	id := node.Generate()
	return id.Int64(),nil
}


func CreateSnowflakeIDStr()(string){
	id,err := CreateSnowflakeID()
	if err != nil {
		return ""
	}

	return strconv.FormatInt(id, 10)

}